<%
String name = request.getParameter("name");
String password = request.getParameter("password");
boolean isSignedIn = false;

System.out.println("request -> name -> " + name + " -> password -> " + password + " -> isSignedIn -> " + isSignedIn);

if (null != name && null != password && !name.equals("") && !password.equals(""))
{
	session.setAttribute("name", name);
	session.setAttribute("password", password);
	isSignedIn = true;
}
else
{
	name = (String) session.getAttribute("name");
	password = (String) session.getAttribute("password");
	
	System.out.println("session -> name -> " + name + " -> password -> " + password + " -> isSignedIn -> " + isSignedIn);

	if (null != name && null != password && !name.equals("") && !password.equals(""))
	{
		isSignedIn = true;
	}
}
%>

<html>
	<head><title>Digur</title></head>
	
	<body>
		<table border="0">
			<tr>
				<td>
					<h3>Digur</h3>
				</td>
				<td>
					<a href="digur.public.jsp" target="stream_frame">Public</a>
				</td>
				
				<td>
					<%
					if (isSignedIn)
					{
					%>
						<a href="digur.user.jsp" target="stream_frame">Profile</a>
					<%
					}
					else
					{
					%>
					<form method="post" action="digur.jsp">
						username:<input type="text" name="name" size="20" />
						password:<input type="password" name="password" size="20" />
						<input type="submit" value="Sign in" />
					</form>
					<%
					}
					%>
				</td>
			</tr>
		</table>
		
		<iframe name="stream_frame" src=<%= isSignedIn ? "digur.user.jsp" : "digur.public.jsp" %> width="100%" height="100%" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"
			onload="this.height=stream_frame.document.body.scrollHeight"/>
	</body>
</html>